FROM python:2.7.17-alpine as builder

COPY requirements.txt .

RUN pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com --no-cache-dir -r requirements.txt

#  多阶段构建，进行瘦身
FROM python:2.7.17-alpine


RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo "Asia/shanghai" >> /etc/timezone

COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/local/lib/python2.7/site-packages  /usr/local/lib/python2.7/site-packages

WORKDIR /app

COPY . .

EXPOSE 9981

# Define environment variable
ENV NAME World

CMD ["python", "./app.py"]
